package chapter12.section5;
/*程序12-7:接收数据包的准备工作*/
import java.io.*;
import java.net.*;
public class PrepareForReceive {
	  public static void main(String[] args) throws IOException {	
//创建DatagramSocket实例socket
	DatagramSocket socket = new DatagramSocket(7788);  
	byte[] buf = new byte[64];//设置缓冲区长度
  //创建DatagramPacket实例packet
	DatagramPacket packet = new DatagramPacket(
buf, buf.length);
	socket.receive(packet);//socket对象等待接收数据
	  }
}